package com.ssy.lingxi.purchase.api.enums.purchase;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 采购报价单工作流内部部状态枚举
 *  0.已完成 1.待提交审核 2.待审核(一级) 3.待审核(二级) 4.待提交报价单 5.待比价 6.审核通过(一级)  7.审核通过(二级) 8.审核不通过(一级) 9.审核通过(二级)
 */
public enum QuotedPriceInteriorWorkStateEnum {
    STAY_SUBMIT_EXAMINE(11, "待提交审核报价单"),
    STAY_EXAMINE1(12, "待审核报价单(一级)"),
    STAY_EXAMINE2(13, "待审核报价单(二级)"),
    STAY_SUBMIT_EXAMINE_QUOTEDPRICE(14, "待提交报价单"),
    EXAMINE_NOT_ADOPT1(15, "审核报价单不通过(一级)"),
    EXAMINE_NOT_ADOPT2(16, "审核报价单不通过(二级)"),
    COMPLETE(17, "已提交报价单"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    QuotedPriceInteriorWorkStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        QuotedPriceInteriorWorkStateEnum workEnum = Arrays.stream(QuotedPriceInteriorWorkStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(QuotedPriceInteriorWorkStateEnum.class, workEnum.getState());
    }
}
